import {fileURLToPath, URL} from 'node:url'

import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [
        vue(),
    ],
    server: {//服务器
        proxy: {
            "/amap": {
                target: "http://127.0.0.1:5001",
                ws: true,
                /** 是否允许跨域 */
                changeOrigin: true,
                rewrite: (path) => path.replace("/amap", "/amap")
            },
            "/gaodemap": {
                target: "http://127.0.0.1:5001",
                ws: true,
                /** 是否允许跨域 */
                changeOrigin: true,
                rewrite: (path) => path.replace("/gaodemap", "/amap")
            },
        }
    },
    resolve: {
        alias: {
            '@': fileURLToPath(new URL('./src', import.meta.url))
        }
    }
})
